package com.goldsign.pay.common.core.entity.base;

import java.io.Serializable;

import org.springframework.util.StringUtils;

import com.goldsign.pay.common.core.persistence.enums.GenReasonEnum;


public abstract class BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;
	
	public String id;
	
	protected boolean isNewRecord = false;
	
	public abstract void preInsert();
	
	public abstract void preUpdate();
	
	public abstract void  preUpdateWithBackup(GenReasonEnum reson);
	
	public boolean isNewRecord() {
        return isNewRecord || StringUtils.isEmpty(getId());
    }

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public BaseEntity() {
		super();
	}

	public BaseEntity(String id) {
		super();
		this.id = id;
	}

	@Override
	public String toString() {
		return "Entity [id=" + id + "]";
	}
}
